import {Space} from "antd";
import {ColumnsType} from "antd/es/table";
import {Link} from "react-router-dom";
import {ReportDetail} from "type/entity/ReportDetail";
import {columnDataIndex, columnOrder, columnRemark} from "./index";

/**
 * 报销单看板表格列定义
 */
export const reportDetailBoardColumns: ColumnsType<ReportDetail> = [
    columnDataIndex,
    {
        key: 'item',
        dataIndex: 'item',
        title: '报销项目',
        width: 110,
        align: "center",
    },
    {
        key: 'amount',
        dataIndex: 'amount',
        title: '消费金额',
        width: 110,
        align: "center",
    },
    {
        key: 'consumeDate',
        dataIndex: 'consumeDate',
        title: '消费时间',
        width: 110,
        align: "center",
    },
    columnRemark,
];

const reportDetailColumns: ColumnsType<ReportDetail> = [
    columnDataIndex,
    {
        key: 'id',
        dataIndex: 'id',
        title: '编号',
        width: 110,
        align: "center",
    },
    {
        key: 'item',
        dataIndex: 'item',
        title: '报销项目',
        width: 110,
        align: "center",
    },
    {
        key: 'amount',
        dataIndex: 'amount',
        title: '消费金额',
        width: 110,
        align: "center",
    },
    {
        key: 'consumeDate',
        dataIndex: 'consumeDate',
        title: '消费时间',
        width: 110,
        align: "center",
    },
    columnRemark,
    {
        key: "options",
        title: "操作",
        dataIndex: "options",
        align: "center",
        width: 110,
        fixed: "right",
        render: (_, record, __) => {
            return <Space size={15}>
                <Link key={"reportDetail-update"} to={"update"} state={{...window.history.state.usr, children: record}}>更新</Link>
                <Link key={"reportDetail-delete"} style={{color: "#c13c3c"}} to={"delete"} state={record}>删除</Link>
            </Space>;
        }
    }
];
export default reportDetailColumns;
